const navModule = ((doc) => {
  let oBurger;
  let oNavList;

  const getElements = () => {
    oBurger = doc.getElementById('J_burger');
    oNavList = doc.getElementById('J_navlist');
  };

  const bindEvent = () => {
    oBurger.addEventListener('click', handleBurgerClick, false);
  };

  const handleBurgerClick = () => {
    // console.log(oNavList.classList);
    //DOMTokenList(4) ['text-sm', 'mt-6', 'hidden', 'md:block', value: 'text-sm mt-6 hidden md:block']
    const list = oNavList.classList;

    //当列表隐藏时
    if (isHidden(list, 'hidden')) {
      list.remove('hidden');
    } else {
      list.add('hidden');
    }
  };

  function isHidden(list, token) {
    return list.contains(token);
  }

  const init = () => {
    getElements();
    bindEvent();
  };

  return init;
})(document);
